home *** CD-ROM | disk | FTP | other *** search
/ Revolution - Das Atari CD Magazin 1997 / Revolution - Das Atari CD Magazin 1.iso / software / anwendng / utility / cbhd502 / src / c / include / scsidrv / scsicd.h < prev    next >
C/C++ Source or Header  |  1997-01-21  |  12KB  |  294 lines

  1. /*{{{}}}*/
  2. /*********************************************************************
  3.  *
  4.  * Kommandos zum Zugriff auf CD-ROMs
  5.  *
  6.  * $Source: u:\k\usr\src\scsi\cbhd\rcs\scsicd.h,v $
  7.  *
  8.  * $Revision: 1.3 $
  9.  *
  10.  * $Author: Steffen_Engel $
  11.  *
  12.  * $Date: 1996/02/14 11:33:52 $
  13.  *
  14.  * $State: Exp $
  15.  *
  16.  **********************************************************************
  17.  * History:
  18.  *
  19.  * $Log: scsicd.h,v $
  20.  * Revision 1.3  1996/02/14  11:33:52  Steffen_Engel
  21.  * keine globalen Kommandostrukturen mehr
  22.  *
  23.  * Revision 1.2  1995/11/28  19:14:14  S_Engel
  24.  * *** empty log message ***
  25.  *
  26.  * Revision 1.1  1995/11/13  23:46:04  S_Engel
  27.  * Initial revision
  28.  *
  29.  *
  30.  *
  31.  *********************************************************************/
  32.  
  33. #ifndef __SCSICD
  34. #define __SCSICD
  35.  
  36. /*-------------------------------------------------------------------------*/
  37. /*-                                                                       -*/
  38. /*- PauseResume entspricht der Pause-Taste des CD-Players.                -*/
  39. /*- SCSI-Opcode $4B                                                       -*/
  40. /*-                                                                       -*/
  41. /*- Pause                                                                 -*/
  42. /*-   TRUE  : CD hält an                                                  -*/
  43. /*-   FALSE : CD spielt weiter                                            -*/
  44. /*-                                                                       -*/
  45. /*-------------------------------------------------------------------------*/
  46. LONG PauseResume(BOOLEAN Pause);
  47.  
  48.  
  49. /*-------------------------------------------------------------------------*/
  50. /*-                                                                       -*/
  51. /*- PlayAudio spielt von einee CD ab BlockAdr TransLength Blöcke ab.      -*/
  52. /*- SCSI-Opcode $A5                                                       -*/
  53. /*-                                                                       -*/
  54. /*-------------------------------------------------------------------------*/
  55. LONG PlayAudio(LONG BlockAdr, LONG TransLength);
  56.  
  57.  
  58. typedef union
  59. {
  60.   struct {
  61.   BYTE Resrvd;
  62.   BYTE M;
  63.   BYTE S;
  64.   BYTE F;
  65.   } s;
  66.   ULONG longval;
  67. }tMSF;
  68.  
  69. /*-------------------------------------------------------------------------*/
  70. /*-                                                                       -*/
  71. /*- PlayAudioMSF startet die CD an der absoluten Position Start und läßt  -*/
  72. /*- sie bis Stop laufen.                                                  -*/
  73. /*- SCSI-Opcode $47                                                       -*/
  74. /*-                                                                       -*/
  75. /*-                                                                       -*/
  76. /*-------------------------------------------------------------------------*/
  77. LONG PlayAudioMSF(tMSF Start, tMSF Stop);
  78.  
  79.  
  80. /*-------------------------------------------------------------------------*/
  81. /*-                                                                       -*/
  82. /*- Spielt die Stücke StarTrack.StartIndex bis EndTrack.EndIndex          -*/
  83. /*- SCSI-Opcode $48                                                       -*/
  84. /*-                                                                       -*/
  85. /*-                                                                       -*/
  86. /*-------------------------------------------------------------------------*/
  87. LONG PlayAudioTrack(UWORD StartTrack, UWORD StartIndex, UWORD EndTrack, UWORD EndIndex);
  88.  
  89.  
  90. /*-------------------------------------------------------------------------*/
  91. /*-                                                                       -*/
  92. /*- PlayAudioRelative startet den CD-Player bei der Position RelAdr in    -*/
  93. /*- dem Track StartTrack und spielt Len Blöcke ab.                        -*/
  94. /*- SCSI-Opcode $49                                                       -*/
  95. /*-                                                                       -*/
  96. /*-                                                                       -*/
  97. /*-------------------------------------------------------------------------*/
  98. LONG PlayAudioRelative(UWORD StartTrack, ULONG RelAdr, ULONG Len);
  99.  
  100.  
  101. /*-------------------------------------------------------------------------*/
  102. /*-                                                                       -*/
  103. /*- ReadHeader fragt den Header der angegebenen BlockAdr ab.              -*/
  104. /*-                                                                       -*/
  105. /*- SCSI-Opcode $44                                                       -*/
  106. /*-                                                                       -*/
  107. /*-                                                                       -*/
  108. /*-------------------------------------------------------------------------*/
  109. LONG ReadHeader(BOOLEAN  MSF, ULONG BlockAdr,
  110.                 BYTE    *Mode, tMSF *AbsoluteAdr);
  111.  
  112. /* Werte für SubFormat */
  113. #define SubQ      0
  114. #define CDPos      1
  115. #define MediaCatNo 2
  116. #define TrackISRC  3
  117. /* Audio-Status-Codes */
  118. #define NotSupp    0
  119. #define Playing    0x11
  120. #define Paused     0x12
  121. #define Complete   0x13
  122. #define ErrStop    0x14
  123. #define NoStatus   0x15
  124. /* Werte für Adr (in ADRControl) */
  125. #define NoQInfo   0     /* Sub-channel Q mode information not supplied. */
  126. #define QencPOS   1     /* Sub-channel Q encodes current position data. */
  127. #define QencUPC   2     /* Sub-channel Q encodes media catalog number.  */
  128. #define QencISRC  3     /* Sub-channel Q encodes ISRC.                  */
  129.  
  130.  
  131. #define AUDIOEMPHASIS 1
  132. #define COPYPERMIT    2
  133. #define DATATRACK     4
  134. #define FOURCHANNEL   8
  135.  
  136. #if 0
  137. /* ControlBits:
  138.  Bit          0                                 1
  139.   0       Audio without pre-emphasis    Audio with pre-emphasis  
  140.   1       Digital copy prohibited       Digital copy permitted   
  141.   2       Audio track                   Data track               
  142.   3       Two channel audio             Four channel audio       
  143.  */
  144.  
  145. TYPE  tADRControl = (Ctrl0, Ctrl1, Ctrl2, Ctrl3,
  146.                      Adr0, Adr1, Adr2, Adr3);
  147.       tsADRControl = SET OF tADRControl;
  148.       tSubData = RECORD
  149.                   Res0        : BYTE;
  150.                   AudioStatus : UChar;
  151.                   SubLen      : SHORTCARD;  /* Header 4 Bytes */
  152.  
  153.                   SubFormat   : BYTE;
  154.                   ADRControl  : tsADRControl;
  155.                   TrackNo     : UChar;
  156.  
  157.                   CASE : SHORTCARD OF
  158.                     SubQ      :
  159.                                 QIndex    : UChar;
  160.                                 QAbsAdr   : tMSF;       /* auf der CD */
  161.                                 QRelAdr   : tMSF;       /* im Track   */
  162.                                 QMCVal    : BYTE;       /* Bit 8 */
  163.                                 QUPC14    : BYTE;
  164.                                 QUPC      : ARRAY[0..13] OF BYTE;
  165.                                 QTCVal    : BYTE;       /* Bit 8 */
  166.                                 QISRC14   : BYTE;
  167.                                 QISRC     : ARRAY[0..13] OF BYTE;
  168.                                 /* SubQ : insgesamt 48 Bytes */
  169.  
  170.                    |CDPos     :
  171.                                 IndexNo   : UChar;
  172.                                 AbsAdr    : tMSF;       /* auf der CD */
  173.                                 RelAdr    : tMSF;       /* im Track   */
  174.                                 /* CDPos : insgesamt 16 Bytes */
  175.  
  176.                    |MediaCatNo:
  177.                                 upcRes7   : BYTE;
  178.                                 MCVal     : BYTE;       /* Bit 8 */
  179.                                 UPC14     : BYTE;
  180.                                 UPC       : ARRAY[0..13] OF BYTE;
  181.                                 /* MediaCatNo : insgesamt 24 Bytes */
  182.  
  183.                    |TrackISRC :
  184.                                 isrcRes7  : BYTE;
  185.                                 TCVal     : BYTE;       /* Bit 8 */
  186.                                 ISRC14    : BYTE;
  187.                                 ISRC      : ARRAY[0..13] OF BYTE;
  188.                                 /* TrackISR : insgesamt 24 Bytes */
  189.                   END;
  190.                 END;
  191. #endif
  192.  
  193. typedef struct{
  194.   BYTE  Res0;
  195.   UCHAR AudioStatus;
  196.   UWORD SubLen;           /* Header 4 Bytes */
  197.  
  198.   BYTE  SubFormat;
  199.   BYTE  ADRControl;
  200.   UCHAR TrackNo;
  201.   union{
  202.     struct{
  203.       UCHAR QIndex;
  204.       tMSF QAbsAdr;         /* auf der CD */
  205.       tMSF QRelAdr;         /* im Track   */
  206.       BYTE QMCVal;          /* Bit 8 */
  207.       BYTE QUPC14;
  208.       BYTE QUPC[14];
  209.       BYTE QTCVal;          /* Bit 8 */
  210.       BYTE QISRC14;
  211.       BYTE QISRC[14];
  212.       /* SubQ : insgesamt 48 Bytes */
  213.     } subq;
  214.     struct {
  215.       UCHAR   IndexNo;
  216.       tMSF    AbsAdr;       /* auf der CD */
  217.       tMSF    RelAdr;       /* im Track   */
  218.       /* CDPos : insgesamt 16 Bytes */
  219.     } cdpos;
  220.   } data;
  221. /*
  222.                    |MediaCatNo:
  223.                                 upcRes7   : BYTE;
  224.                                 MCVal     : BYTE;       /* Bit 8 */
  225.                                 UPC14     : BYTE;
  226.                                 UPC       : ARRAY[0..13] OF BYTE;
  227.                                 /* MediaCatNo : insgesamt 24 Bytes */
  228.  
  229.                    |TrackISRC :
  230.                                 isrcRes7  : BYTE;
  231.                                 TCVal     : BYTE;       /* Bit 8 */
  232.                                 ISRC14    : BYTE;
  233.                                 ISRC      : ARRAY[0..13] OF BYTE;
  234.                                 /* TrackISR : insgesamt 24 Bytes */
  235.                   END;
  236.                 END;
  237. */
  238. } tSubData;
  239.  
  240. /*-------------------------------------------------------------------------*/
  241. /*-                                                                       -*/
  242. /*- Sub-Channel Daten abfragen                                            -*/
  243. /*- Datenformat ist tSubData.                                             -*/
  244. /*- SCSI-Opcode $42                                                       -*/
  245. /*-                                                                       -*/
  246. /*-                                                                       -*/
  247. /*-------------------------------------------------------------------------*/
  248. LONG ReadSubChannel(BOOLEAN MSF, BOOLEAN SUBQ,
  249.                        UWORD SubFormat, UWORD Track,
  250.                        void *Data, UWORD Len);
  251.  
  252.  
  253.  
  254. #define MAXTOC 100          /* Maximum laut SCSI-2 */
  255. typedef struct{
  256.   BYTE  Res0;
  257.   UBYTE ADRControl;
  258.   UCHAR TrackNo;
  259.   BYTE  Res3;
  260.   tMSF  AbsAddress;
  261. }tTOCEntry;
  262.  
  263. typedef struct
  264. {
  265.   UWORD TOCLen;           /* ohne TOCLen-Feld */
  266.   UCHAR FirstTrack;
  267.   UCHAR LastTrack;
  268. }tTOCHead;
  269.  
  270. typedef struct
  271. {
  272.   tTOCHead Head;
  273.   tTOCEntry Entry[MAXTOC];
  274. }tTOC;
  275.  
  276. /*-------------------------------------------------------------------------*/
  277. /*-                                                                       -*/
  278. /*- ReadTOC liest das Inhaltsverzeichnis einer CD ein.                    -*/
  279. /*- Wenn StartTrack # 0 ist, so wird das Inhaltsverzeichnis ab dem ange-  -*/
  280. /*- gebenen Track angegeben.                                              -*/
  281. /*- SCSI-Opcode $43                                                       -*/
  282. /*-                                                                       -*/
  283. /*-                                                                       -*/
  284. /*-------------------------------------------------------------------------*/
  285. LONG ReadTOC(BOOLEAN MSF, UWORD StartTrack,
  286.                   void *Buffer, UWORD Len);
  287.  
  288. BOOLEAN init_scsicd(void);
  289.  
  290.  
  291. #endif
  292.  
  293.  
  294.